﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
// DNN
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Users;
// Codex
using CodexOmega.Modules.VideoLinker;
using CodexOmegaClassLibrary.Constants;

namespace CodexOmega.Modules.VideoLinker
{
    public partial class VideoDetail : PortalModuleBase
    {
        #region Events

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request["id"]))
            {
                BindData(Request["id"]);
            }
        }

        #endregion

        #region Methods

        private void BindData(string id)
        {
            VideoLinkerController videoLinkerController = new VideoLinkerController();

            // get videoID
            int videoID = CodexOmegaClassLibrary.Utils.DataUtils.getNumericID(id);

            // get video on ID
            VideoLinkerInfo videoLinkerInfo = videoLinkerController.GetVideoLink(videoID);

            if (videoLinkerInfo != null)
            {
                // bind controls
                lblVideoTitle.Text = videoLinkerInfo.VideoTitle;
                litVideoCode.Text = videoLinkerInfo.VideoCode;
                lblVideoDescription.Text = videoLinkerInfo.VideoDescription;
            }
        }

        #endregion
    }
}
